<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>画布基础案例</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        canvas {
            border: 1px solid red;
        }
    </style>
</head>

<body>
    <!-- 默认大小：302*152 -->
    <canvas></canvas>
    <!-- 给`canvas`设置宽高的时候要通过内嵌的属性`width`和`height`来设置，如果通过CSS设置则会失真 -->
    <canvas width="400" height="400"></canvas>
    <!-- PS：通过CSS设置，相当于把默认画布大小（`302*152`左右）拉伸一下 -->
</body>

</html>